<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">
	$(function() {
		var $grid = $('#grid_contract');
		var $title = '合同';
		var $baseUrl = 'file/contract';
		$grid.datagrid({
			title : $title + '列表',
			url : $baseUrl + '/page?sort=createTime,desc',
			dialog : {
				url : $baseUrl,
				name : $title,
				create : {
					width : 400,
					height : 400
				},
				update : {
					width : 400,
					height : 400
				}
			},
			pagination : true,
			pageSize : 50,
			pageList : [ 50, 100, 200 ],
			columns : [ [ {
				field : 'type',
				width : 120,
				title : '合同类型',
				formatter : function(value, row, index) {
					return row.type ? row.type.name : '';
				}
			}, {
				field : 'dept',
				width : 120,
				title : '完成部门',
				formatter : function(value, row, index) {
					return value == null ? '' : value.name;
				}
			}, {
				field : 'sn',
				width : 120,
				title : '合同编号'
			}, {
				field : 'name',
				width : 180,
				title : '合同名称',
				formatter : function(value, row, index) {
					return '<a class="file_link" href="file/contract/download?id=' + row.id + '">' + row.name + '</a>';
				}
			}, {
				field : 'signedDate',
				width : 120,
				title : '签订日期'
			}, {
				field : 'cost',
				width : 120,
				title : '合同金额'
			}, $.fields.description, {
				field : 'user',
				width : 80,
				title : '上传者',
				formatter : function(value, row, index) {
					return row.createUser ? row.createUser.name : '';
				}
			}, {
				field : 'createTime',
				width : 180,
				title : '上传时间'
			}, {
				field : 'lastModifyTime',
				width : 180,
				title : '更新时间'
			} ] ],
			toolbar : [ $.crudgrid.buttons.create, $.crudgrid.buttons.update, $.crudgrid.buttons.remove, '-', $.crudgrid.buttons.refresh ]
		}).treegrid('search.init');
	});
</script>
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',split:true,border:false">
		<table id="grid_contract"></table>
	</div>
</div>